﻿using System;
using System.Net;

namespace FileDistributor.FileTransfer
{
    public abstract class FtpUploaderBase : IFtpUpLoader
    {
        public event EventHandler<FtpUploadEventArgs> Success;
        public event EventHandler<FtpUploadEventArgs> Failure;

        public abstract void Upload(string sourcePath, Uri targetUri, NetworkCredential credential);

        protected void InvokeSuccessEventHandlers(FtpUploadEventArgs e)
        {
            var handler = Success;
            if (handler != null) handler(this, e);
        }

        protected void InvokeFailureEventHandlers(FtpUploadEventArgs e)
        {
            var handler = Failure;
            if (handler != null) handler(this, e);
        }
    }
}
